//
//  LKMyTradeCountViewController.m
//  Mideleague_Agent
//
//  Created by Zhiwang on 2020/6/22.
//  Copyright © 2020 Zhiwang. All rights reserved.
//

#import "LKMyTradeCountViewController.h"
#import "SegmentTapView.h"
#import "FlipTableView.h"
#import "LKMytradeCountSonLeftViewController.h"
#import "LKMytradeCountSonRightViewController.h"
@interface LKMyTradeCountViewController ()<FlipTableViewDelegate,SegmentTapViewDelegate>
@property (nonatomic, strong)SegmentTapView *segment;
@property (nonatomic, strong)FlipTableView *flipView;
@end

@implementation LKMyTradeCountViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"交易统计";
    [self createSonViewcontroller];
    // Do any additional setup after loading the view.
}
//创建子视图控制器
-(void)createSonViewcontroller{
    WS(weakSelf)
        self.segment = [[SegmentTapView alloc] initWithFrame:CGRectMake(0,NAVIGATION_BAR_HEIGHT + 10, WIDTH, 40) withDataArray:[NSArray arrayWithObjects:@"数据汇总",@"趋势分析", nil] withFont:14];
        self.segment.delegate = self;
        self.segment.lineColor = yellowDefaultColor;
        self.segment.titleFont = 14;
        self.segment.textNomalColor = COLOR_HEX(0x333333);
        self.segment.textSelectedColor = yellowDefaultColor;
//        [self.navigationController.navigationBar addSubview:self.segment];
    [self.view addSubview:self.segment];
    LKMytradeCountSonLeftViewController *list1 = [[LKMytradeCountSonLeftViewController alloc] init];
    LKMytradeCountSonRightViewController *list2 = [[LKMytradeCountSonRightViewController alloc] init];
        self.flipView = [[FlipTableView alloc] initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT + 60, WIDTH, HEIGHT - (NAVIGATION_BAR_HEIGHT + 40)) withArray:@[list1,list2]];
        self.flipView.delegate = self;
        [self.view addSubview:self.flipView];
}
#pragma mark -------- select Index
-(void)selectedIndex:(NSInteger)index
{
    [self.flipView selectIndex:index];
//    NSLog(@"%@",self.types);
}

-(void)scrollChangeToIndex:(NSInteger)index
{
//    NSLog(@"%ld",index);
    [self.segment selectIndex:index];
//    self.types = [NSString stringWithFormat:@"%ld",index];
//    [[NSUserDefaults standardUserDefaults] setObject:self.types forKey:@"subroadiTypeValue"];
////    [[NSNotificationCenter defaultCenter] postNotificationName:@"shopTypeValueChanged" object:@{@"types":self.types}];
//    NSLog(@"%@",self.types);
}
-(void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    [self.segment removeFromSuperview];
    self.segment = nil;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
